package cn.edu.hubu.hubusmartzoohouse.controller;

import cn.edu.hubu.hubusmartzoohouse.entity.Stadium;
import cn.edu.hubu.hubusmartzoohouse.service.StadiumService;
import cn.edu.hubu.hubusmartzoohouse.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class StadiumController {
    @Autowired
    private StadiumService stadiumService;

    @RequestMapping("/stadium/insert")
    public ResultVo insert(Stadium stadium){
        ResultVo vo = stadiumService.insert(stadium);
        return vo;
    }

//    @RequestMapping
//    public ResultVo update(Stadium stadium){
//        return null;
//    }
//
    @RequestMapping
    public ResultVo delete(int stadiumId){
        return null;
    }


    @RequestMapping("/stadium/list")
    public ResultVo list(Integer userId){
        ResultVo vo = stadiumService.listByUserId(userId);
        return vo;
    }

    @RequestMapping("/stadium/delete")
    public ResultVo delete(Integer stadiumId){
        ResultVo vo = stadiumService.logicDelete(stadiumId);
        return vo;
    }

    @RequestMapping("/stadium/get")
    public ResultVo get(Integer stadiumId){
        ResultVo vo = stadiumService.get(stadiumId);
        return vo;
    }

    @RequestMapping("/stadium/update")
    public ResultVo updateStadium(Stadium stadium){
        ResultVo vo = stadiumService.modifyStadium(stadium);
        return vo;
    }

    @RequestMapping("/stadium/serchById")
    public ResultVo serchStadiumById(Integer stadiumId){
        ResultVo vo = stadiumService.searchStadiumById(stadiumId);
        return vo;
    }

    @RequestMapping("/stadium/serchByName")
    public ResultVo serchStadiumByName(String stadiumName){
        ResultVo vo = stadiumService.searchStadiumByName(stadiumName);
        return vo;
    }

}
